#include <iostream>
using namespace std;

typedef long long ll;

const int N = 100010;

int n, m;
ll a[N]; //原数组
ll b[N]; //差分数组用于对a进行区间修改
ll b_tr[N];
ll c_tr[N]; //i*b[i]的树状数组
char op;
ll l, r, d;

int lowbit(int x)
{
    return x & -x;
}

void init() //初始化两个树状数组
{
    for (int i = 1; i <= n; ++i)
    {
        b_tr[i] += b[i];
        c_tr[i] += i * b[i];
        int p = i + lowbit(i);
        if (p <= n)
        {
            b_tr[p] += b_tr[i];
            c_tr[p] += c_tr[i];
        }
    }
    return;
}

void add(int k, ll x) //在b[k]加上x，顺便改一下影响到了的两个树状数组
{
    b[k] += x; //首先是b本身
    for (int i = k; i <= n; i += lowbit(i))
    {
        b_tr[i] += x;     //这个只是增加了x
        c_tr[i] += k * x; //但是对于我来说增加了k倍的x
    }
    return;
}

ll sum(int x)
{
    ll sum = 0;
    for (int i = x; i > 0; i -= lowbit(i)) //首先求一波b1+...+bx
        sum += b_tr[i];
    sum = sum * (x + 1);
    for (int i = x; i > 0; i -= lowbit(i)) //然后减去一波1*b1+...+xbx
        sum -= c_tr[i];
    return sum;
}

int main()
{
    freopen("cin.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        b[i] = a[i] - a[i - 1]; //初始化差分数组
    }
    init(); //初始化树状数组
    while (m--)
    {
        cin >> op;
        if (op == 'C')
        {
            cin >> l >> r >> d;
            add(l, d);
            add(r + 1, -d);
        }
        else
        {
            cin >> l >> r;
            cout << sum(r) - sum(l - 1) << endl;
        }
    }
    return 0;
}